<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
    <title>DayTrader Portfolio</title>
    <link rel="stylesheet" href="style.css" type="text/css" />
</h:head>
<h:body bgcolor="#ffffff" link="#000099" vlink="#000099">
<h:form>
<table height="54">
  <tbody>
    <tr>
            <td bgcolor="#c93333" align="left" width="640" height="10" colspan="5"><b><font
                color="#ffffff">DayTrader Portfolio</font></b></td>
            <td align="center" bgcolor="#000000" width="100" height="10"><font
                color="#ffffff"><b>DayTrader</b></font></td>
        </tr>
        <tr align="left">
            <td><b><h:outputLink value="tradehome.faces">Home</h:outputLink></b><b> </b></td>
            <td><b><h:outputLink value="account.faces">Account</h:outputLink></b><b> </b></td>
            <td><b><h:outputLink value="portfolio.faces">Portfolio</h:outputLink></b><b> </b></td>
            <td><b><h:outputLink value="quote.faces">Quotes/Trade</h:outputLink></b></td>
            <td><b><h:commandLink action="#{tradeapp.logout}">Logoff</h:commandLink></b></td>
            <td></td>
        </tr>
        <tr>
            <td align="right" colspan="6">
            <hr/>
            <font color="#ff0000" size="-2"> <h:outputLabel value="#{accountdata.currentTime}" color="#ffffff" /></font></td>
        </tr>
 <tr>
            <td colspan="6" bgcolor="#ff0000"><blink><b><font color="#ffffff">Alert: The following Order(s) have completed.</font></b></blink></td>
        </tr>
        <tr align="center">
            <td colspan="6">
            <h:dataTable id="orders" value="#{accountdata.closedOrders}"
            var="item" border="1">
            <f:facet name="header">
                <h:outputText value="Alert: The following Order(s) have completed."
                    color="#ff0000" />
            </f:facet>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="order id" />
                </f:facet>
                <h:outputText value="#{item.orderID}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="order status" />
                </f:facet>
                <h:outputText value="#{item.orderStatus}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="creation date" />
                </f:facet>
                <h:outputText value="#{item.openDate}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="completion date" />
                </f:facet>
                <h:outputText value="#{item.completionDate}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="txn fee" />
                </f:facet>
                <h:outputText value="#{item.orderFee}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="type" />
                </f:facet>
                <h:outputText value="#{item.orderType}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="symbol" />
                </f:facet>
                <h:outputText value="#{item.symbol}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="quantity" />
                </f:facet>
                <h:outputText value="#{item.quantity}"></h:outputText>
            </h:column>
        </h:dataTable>
            </td>
        </tr>
       
    </tbody>
</table>
<table width="645">
    <tbody>
        <tr>
            <td valign="top" width="643">
            <table width="100%">
                <tbody>

                    <tr>
                        <td colspan="5" bgcolor="#cccccc"><b>Portfolio </b></td>
                        <td bgcolor="#cccccc" align="right"><b>Number of Holdings: </b><h:outputLabel value="#{portfolio.numberHoldings}" color="#ff0000" /></td>
                    </tr>
                    <tr align="center">
                        <td colspan="6">
                        <CENTER></CENTER>
                        <table border="1" style="font-size: smaller">
                            <CAPTION align="bottom"><b>Portfolio </b></CAPTION>
                            <tbody>
                                <tr align="center" colspan="10">
                                     <h:dataTable id="holdings" value="#{portfolio.holdingDatas}" var="item" binding="#{portfolio.dataTable}" bgcolor="#fafcb6" align="center" border="1">
            <h:column>
                <f:facet name="header">
                    <h:outputText value="holding ID" />
                </f:facet>
                <h:outputText value="#{item.holdingID}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="purchase date" />
                </f:facet>
                <h:outputText value="#{item.purchaseDate}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="symbol" />
                </f:facet>
                <h:outputText value="#{item.quoteID}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="quantity" />
                </f:facet>
                <h:outputText value="#{item.quantity}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="purchase price" />
                </f:facet>
                <h:outputText value="#{item.purchasePrice}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="current price" />
                </f:facet>
                <h:outputText value="#{item.price}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="purchase basis" />
                </f:facet>
                <h:outputText value="#{item.basis}"></h:outputText>
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="market value" />
                </f:facet>
                <h:outputText value="#{item.marketValue}"></h:outputText>
            </h:column>
            
              <h:column>
                <f:facet name="header">
                    <h:outputText value="gain/(loss)" />
                </f:facet>
                <h:outputText value="#{item.gain}"></h:outputText>
            </h:column>
            
             <h:column>
                <f:facet name="header">
                    <h:outputText value="trade" />
                </f:facet>
                <h:commandButton value="sell" action="#{portfolio.sell}"></h:commandButton>                
            </h:column>
        </h:dataTable>
                                </tr>
                               
                                <tr align="center">
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td><b>Total</b></td>
                                    <td align="center">$ <h:outputLabel value="#{portfolio.totalBasis}"/></td>
                                    <td align="center">$ <h:outputLabel value="#{portfolio.totalValue}"/></td>
                                    <td align="center" colspan="2">$ <h:outputLabel value="#{portfolio.totalGain}"/> <h:outputLabel value="#{portfolio.totalGainPercent}"/></td>
                                </tr>
                            </tbody>
                        </table>
                        <CENTER></CENTER>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="6"></td>
                    </tr>
               </tbody>
            </table>
            </td>
        </tr>
    </tbody>
</table>
<table height="54" style="font-size: smaller">
  <tbody>
        <tr>
            <td colspan="2">
            <hr/>
            </td>
        </tr>
        <tr>
            <td colspan="2">
            <table width="100%" style="font-size: smaller">
                <tbody>
                    <tr>
                        <td>Note: Click any <a href="docs/glossary.html">symbol</a> for a quote or to trade.</td>
                        <td align="right"><h:commandButton id="submit" type="submit" value="quotes" action="#{quotedata.getQuotesBySymbols}" />
                        <h:inputText id="symbols" value="#{quotedata.symbols}" required="true"><f:validateLength minimum="1" maximum="40" /></h:inputText></td>
                    </tr>
                </tbody>
            </table>
            </td>
        </tr>
        <tr>
            <td bgcolor="#c93333" align="left" width="640" height="10"><b><font
                color="#ffffff">DayTrader Portfolio</font></b></td>
            <td align="center" bgcolor="#000000" width="100" height="10"><font
                color="#ffffff"><b>DayTrader</b></font></td>
        </tr>
    </tbody>
</table>
</h:form>
</h:body>
</html>
